Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UCS/GTEST: fixed uninitialized value access - v1.17.x #9928

Merged

Conversation

iyastreb
Copy link
Contributor

@iyastreb iyastreb commented Jun 4, 2024

What

This is fix for RM#3919044, double commit into v.1.17.x, master PR is #9917
There are multiple test failures reported as:

==54391== Conditional jump or move depends on uninitialised value(s)
==54391==    at 0x50AE1A2: ucs_rcache_check_overlap (rcache.c:860)
==54391==    by 0x50AE1A2: ucs_rcache_create_region (rcache.c:952)
==54391==    by 0x50AE9AB: ucs_rcache_get (rcache.c:1108)
==54391==    by 0xBE26F4: test_rcache::get(void*, unsigned long, int, unsigned long) (test_rcache.cc:109)
==54391==    by 0xBD33E1: test_rcache_basic_Test::test_body() (test_rcache.cc:276)
==54391==    by 0x637499: ucs::test_base::thread_func(void*) (test.cc:397)
==54391==    by 0x995ADD4: start_thread (in /usr/lib64/libpthread-2.17.so)
==54391==  Uninitialised value was created by a stack allocation

Why ?

Function ucs_rcache_check_overlap was modified in #9441, with additional check whether found region is the only element in the list. The issue reported by ASAN and valgrind happens when returned region list is empty. In this case we access some uninitialized data on the stack:

    ucs_list_link_t region_list;
    ucs_list_head_init(&region_list);
    ucs_rcache_find_regions(rcache, *start, *end - 1, &region_list); << returns empty list

    region = ucs_list_next(&region_list, ucs_rcache_region_t, tmp_list); << access non-existing region by offset on the stack

How ?

Added check that returned list is not empty

@brminich brminich changed the title UCS/GTEST: fixed uninitialized value access UCS/GTEST: fixed uninitialized value access - v1.17.x Jun 4, 2024
@yosefe yosefe enabled auto-merge June 4, 2024 08:31
@yosefe yosefe added this to the 1.17.0 milestone Jun 5, 2024
@yosefe yosefe merged commit d376a77 into openucx:v1.17.x Jun 5, 2024
138 checks passed
@iyastreb iyastreb deleted the ucs/gtest/uninitialized-value-access-1.17 branch June 6, 2024 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants